package de.haw.HES.Warenmanagement;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

import de.haw.HES.Vertrieb.Menge;
import de.haw.HES.base.FachObjekt;

@Entity
@Table(name="Produkt")
public class Produkt implements FachObjekt {

	private int id;
	private String name;
	private int lagerbestand;
	private List<Menge> menge = new ArrayList<Menge>();

	@Id
	@GenericGenerator(name = "generator", strategy = "increment")
    @GeneratedValue(generator = "generator")
	@Column(name="produkt_id")
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

//	public int getLagerbestand() {
//		return lagerbestand;
//	}
//
//	public void setLagerbestand(int lagerbestand) {
//		this.lagerbestand = lagerbestand;
//	}
	
	@OneToMany(fetch=FetchType.LAZY,mappedBy="pk.produkt")
	public List<Menge> getMenge() {
		return menge;
	}

	public void setMenge(List<Menge> menge) {
		this.menge = menge;
	}
	
}
